package top.mengchaob.gitManage.jpa;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import top.mengchaob.fileserver.netty.table.FileDo;
import top.mengchaob.gitManage.table.GitFileDo;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @title：
 * @author: mengchaob
 * @date: 2021年05月12日 14:42
 * @description:
 */
public interface GitFileRepository extends JpaRepository<GitFileDo, String> {

    @Query(value="select f from FileDo f where f.fileId in (select g.fileId from GitFileDo g where g.branchName=?1)")
    List<FileDo> getGitFileDoByBranchName(@Param("branchName")String branchName);
    //查询所有的FileDo
    @Query(value="select distinct g.branchName from GitFileDo g where g.fileId in(select f from FileDo f where f.type='2')")
    List<String> getGitFileDoUseTree();

}
